<template>
  <div class="network-operating-record">
    <search-table
      :columns="columns"
      :data="operatingRecordList"
      @change-page="changePageNow"
      @change-size="changePageSize"
      :total="total"
      :page.sync="pageIndex"
      :size.sync="pageSize"
    >
      <template slot="select-group">
        <!-- <Select filterable
          v-model="teamName"
          placeholder="请选择团队"
          filterable
          clearable
          @on-change="changePageNow(1)"
        >
          <Option
            v-for="item in dataList"
            :value="item.teamName"
            :key="item.id"
            :title="item.teamName"
            >{{ item.teamName }}</Option
          >
        </Select> -->
      </template>
    </search-table>
  </div>
</template>

<script>
import SearchTable from "@/components/SearchTable/SearchTable";
import {getaccessgrouplistdis} from '@/api/access_new';
import {businessSystem4ContestPage,product4ContestPage} from '@/api/product';
export default {
  name: "assetStatistics",
  components: {
    SearchTable
  },
  props: {
    disabledAllBtn: {
      type: Boolean,
      default: false,
    },
    useApiType:{
      type:Number,
      default:()=> null
    }
  },
  data() {
    return {
      teamName:"",
      operatingRecordList: [],
      total: 0, // 总数据量
      pageSize: 10, // 分页大小
      pageIndex: 1, // 当前页
      columns: [
        {
          placement: "top-left",
          title: "名称",
          key: "name",
          align: "center",
          tooltip: true,
          width: 230,
        },
        {
          placement: "top-left",
          title: "描述",
          key: "description",
          width: 230,
        },
        {
          title: "创建时间",
          width: 150,
          key: "created",
        },
        {
          title: "创建人",
          width: 150,
          tooltip: true,
          key: "creatorName",
        },
        {
          title: "操作",
          key: "result",
          show:false,
          render: (h, params) => {
            let result = params.row.result;
            return h(
              "Tag",
              {
                props: {
                  color:
                    result ? "blue": 'red',
                },
              },
              result?'成功':'失败'
            );
          }
        },
        // {
        //   title: "操作人",
        //   width: 150,
        //   key: "userName",
        // }
      ],
      dataList:[]
    };
  },
  mounted() {
    if(this.useApiType){
      this.getqueryLogsList()
    }
    if(this.useApiType ===2){
      this.columns.splice(1, 0, {
        key: 'vendorName',
        title: '供应厂商名称',
        width: 200,
        tooltip: true,
      })
    }
    // this.getQueryTeamList()
  },
  computed: {},
  methods: {
    getQueryTeamList(){
      getaccessgrouplistdis({
        pageIndex: 1,
        pageSize: 9999,
        isSuperGroup: false
      },this.$route.query.id).then(res=>{
        const filter = res.data.items.filter(item => item.teamName !== '目标方管理员组')
        this.dataList = filter
      })
    },
    //查询
    getqueryLogsList(){
      let api= this.useApiType === 1 ? businessSystem4ContestPage:product4ContestPage
      let params = {  
          pageIndex:this.pageIndex,
          pageSize:this.pageSize,
          // teamName:this.teamName,
          contestId:this.$route.query.id
        }
        api(params).then(data=>{
            if(data.code==1){
                this.operatingRecordList = data.data.items
                this.total = data.data.total
            }
        }).catch(()=>{
            
        })
    },
    // 修改分页大小
    changePageSize(val) {
      this.pageSize = val;
      this.getqueryLogsList();
    },
    // 修改当前页
    changePageNow(val) {
      this.pageIndex = val;
      this.getqueryLogsList();
    },
  },
  watch: {},
  beforeDestroy() {},
};
</script>

<style scoped>
</style>